package com.example.demo.service;


import com.example.demo.dao.BookDao;
import com.example.demo.entity.BookInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;
//@Component
@Service
public class BookService {
    @Autowired
    private BookDao bookDao;
    public List<BookInfo> getList(){
        //BookDao bookDao = new BookDao();
        List<BookInfo> list = new ArrayList<>();
        list=bookDao.mocData();
        for(BookInfo bookInfo:list){
            if(bookInfo.getStatus()==1){
                bookInfo.setStatusCN("可借阅");
            }
            else{
                bookInfo.setStatusCN("不可借阅");
            }
        }
        return list;
    }
}
